get rid of the last usages of QByteArray::data where QByteArray::constData will work.
authortsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 16 Sep 2014 22:39:01 +0000 (22:39 +0000)
committertsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 16 Sep 2014 22:39:01 +0000 (22:39 +0000)
14 files changed:
gpsbabel/an1.cc
gpsbabel/compegps.cc
gpsbabel/csv_util.cc
gpsbabel/delbin.cc
gpsbabel/garmin_txt.cc
gpsbabel/gdb.cc
gpsbabel/gpsutil.cc
gpsbabel/gtm.cc
gpsbabel/lmx.cc
gpsbabel/maggeo.cc
gpsbabel/magproto.cc
gpsbabel/vcf.cc
gpsbabel/xmlgeneric.cc
gpsbabel/xol.cc

index 6ce63cb056ca54815536d1328f176f15ae6ac21f..f2be0dd3520ed6767f44f75400a759c12219976d 100644 (file)
@@ -777,10 +777,10 @@ Write_One_AN1_Waypoint(const Waypoint* wpt)
 #if NEW_STRINGS
     char* extra = (char*) xmalloc(25 + wpt->gc_data->placer.length() + wpt->shortname.length());
 #else
-    char* extra = (char*) xmalloc(25 + strlen(wpt->gc_data->placer.toUtf8().data()) + strlen(wpt->shortname));
+    char* extra = (char*) xmalloc(25 + strlen(CSTR(wpt->gc_data->placer)) + strlen(wpt->shortname));
 #endif
     sprintf(extra, "\r\nBy %s\r\n%s (%1.1f/%1.1f)",
-            wpt->gc_data->placer.toUtf8().data(),
+            CSTR(wpt->gc_data->placer),
             CSTRc(wpt->shortname), wpt->gc_data->diff/10.0,
             wpt->gc_data->terr/10.0);
     rec->name = xstrappend(rec->name, extra);
@@ -791,7 +791,7 @@ Write_One_AN1_Waypoint(const Waypoint* wpt)
     UrlLink l = wpt->GetUrlLink();
     int len = 7 + l.url_.length();
     char* extra = (char*)xmalloc(len);
-    sprintf(extra, "{URL=%s}", l.url_.toUtf8().data());
+    sprintf(extra, "{URL=%s}", CSTR(l.url_));
     rec->name = xstrappend(rec->name, extra);
     xfree(extra);
     if(rec->url) {
index 3bd13be38ad79e4f56c46ecedf139f31d5091c98..d5ea38d1fa0b9c7cde963d072f0ec17a6abdf553 100644 (file)
@@ -503,7 +503,7 @@ write_waypt_cb(const Waypoint* wpt)
   if ((wpt->icon_descr != NULL) || (wpt->wpt_flags.proximity) || \
       (option_icon != NULL)) {
     gbfprintf(fout, "w  %s,0,0.0,16777215,255,1,7,,%.1f\n",
-              wpt->icon_descr.isNull() ? "Waypoint" : wpt->icon_descr.toUtf8().data(),
+              wpt->icon_descr.isNull() ? "Waypoint" : CSTR(wpt->icon_descr),
               WAYPT_GET(wpt, proximity, 0));
   }
 }
index c597efa1faa8b20863d7a5b4bf80826183189226..f5a1f69f02f9bdb5d6306aac720f95e427028d8b 100644 (file)
@@ -36,7 +36,7 @@
 /* macros */
 #define LAT_DIR(a) a < 0.0 ? 'S' : 'N'
 #define LON_DIR(a) a < 0.0 ? 'W' : 'E'
-#define NONULL(a) a.isNull() ? "" : a.toLatin1().data()
+#define NONULL(a) a.isNull() ? "" : CSTRc(a)
 #define ISWHITESPACE(a) ((a == ' ') || (a == '\t'))
 
 /* convert excel time (days since 1900) to time_t and back again */
@@ -1687,13 +1687,13 @@ xcsv_waypt_pr(const Waypoint* wpt)
       if (wpt->HasUrlLink()) {
         UrlLink l = wpt->GetUrlLink();
         buff = QString().sprintf(fmp->printfc,
-                 !l.url_link_text_.isEmpty() ? l.url_link_text_.toUtf8().data() : fmp->val);
+                 !l.url_link_text_.isEmpty() ? CSTR(l.url_link_text_) : fmp->val);
       }
       break;
     case XT_ICON_DESCR:
       buff = QString().sprintf(fmp->printfc,
                 (!wpt->icon_descr.isNull()) ?
-                wpt->icon_descr.toUtf8().data() : fmp->val);
+                CSTR(wpt->icon_descr) : fmp->val);
       break;
 
       /* LATITUDE CONVERSION***********************************************/
@@ -1968,11 +1968,11 @@ xcsv_waypt_pr(const Waypoint* wpt)
       field_is_unknown = wpt->gc_data->type == gt_unknown;
       break;
     case XT_GEOCACHE_HINT:
-      buff = QString().sprintf(fmp->printfc, wpt->gc_data->hint.toUtf8().data());
+      buff = QString().sprintf(fmp->printfc, CSTR(wpt->gc_data->hint));
       field_is_unknown = !wpt->gc_data->hint.isEmpty();
       break;
     case XT_GEOCACHE_PLACER:
-      buff = QString().sprintf(fmp->printfc, wpt->gc_data->placer.toUtf8().data());
+      buff = QString().sprintf(fmp->printfc, CSTR(wpt->gc_data->placer));
       field_is_unknown = !wpt->gc_data->placer.isEmpty();
       break;
     case XT_GEOCACHE_ISAVAILABLE:
index 0284711ef5ec14c5a8aa9b94b5c96f44079a1c72..588bd60e79fda3c0b9dad69cf2570ac6dc02b0bf 100644 (file)
@@ -1437,7 +1437,7 @@ write_waypoint(const Waypoint* wp)
   if (symbol < 0) {
     symbol = 0;
     if (!wp->icon_descr.isNull()) {
-      symbol = waypoint_symbol_index(wp->icon_descr.toUtf8().data());
+      symbol = waypoint_symbol_index(CSTR(wp->icon_descr));
     }
   }
   p->symbol = symbol;
index 722238a1dbb4665eb7a67c10301d1164dc10f829..27548afd0a2e2d68e63ebb138f5b0b794cfd208b 100644 (file)
@@ -529,7 +529,7 @@ print_string(const char* fmt, const char* string)
 static void
 print_string(const char* fmt, const QString& string)
 {
-  print_string(fmt, string.toUtf8().data());
+  print_string(fmt, CSTR(string));
 }
 
 
index 05192504a53d8d2c37b78b939fe122c8bab8954a..cab77f9e8dadfc63d35b6fb9694f2ba1df4dfb70 100644 (file)
@@ -443,7 +443,7 @@ gdb_write_cstr_list(const char* str)
 static void
 gdb_write_cstr_list(const QString& str)
 {
-  return gdb_write_cstr_list(str.toLatin1().data());
+  return gdb_write_cstr_list(CSTRc(str));
 }
 
 static void
@@ -1438,7 +1438,7 @@ write_waypoint(
     cnt += wpt->url_link_list_.size();
     FWRITE_i32(cnt);
     foreach(UrlLink l, wpt->GetUrlLinks()) {
-      FWRITE_CSTR(l.url_.toUtf8().data());
+      FWRITE_CSTR(l.url_);
     }
   }
 
index b558abe7c71fb2dafda078a92ce96f8bc203d3da..19ba02a232b18071dddacb7a3a26d8eff15c0f4e 100644 (file)
@@ -159,7 +159,7 @@ gpsutil_disp(const Waypoint* wpt)
              (wpt->altitude < 0.0)) ? 0 : wpt->altitude,
             'm',
             CSTRc(wpt->description) ? tdesc : "",
-            icon_token.toUtf8().data());
+            CSTR(icon_token));
 
   xfree(tdesc);
 }
index 7075432b6c44090c49ffa5afee3d940a9ecf8bcf..5b4bf52dc30c1ceb79723088ae4ade46dce9c9f6 100644 (file)
@@ -151,7 +151,7 @@ fwrite_string(gbfile* fd, const QString& str)
     fwrite_integer(fd, 0);
   } else {
     fwrite_integer(fd, str.length());
-    gbfwrite(str.toLatin1().data(), 1, str.length(), fd);
+    gbfwrite(CSTRc(str), 1, str.length(), fd);
   }
 }
 
index c46ba936884e8a240262849a7305cf800a917424..779914192ac8c957afccbbd5e953dad62b9846d4 100644 (file)
@@ -185,7 +185,7 @@ lmx_write_xml(int tag, const QString& data, int indent)
     gbfputc(0x03, ofd); // inline string follows
     gbfputcstr(data, ofd);
   } else {
-    char* tmp_ent = xml_entitize(data.toUtf8().data());
+    char* tmp_ent = xml_entitize(CSTR(data));
     gbfputs(tmp_ent, ofd);
     xfree(tmp_ent);
   }
index a960d1f271f1149a5f39c701d6fd7cf937cf47d3..1ba108a105b08afae8ccc980f9c3c9bed63e1e31 100644 (file)
@@ -295,8 +295,8 @@ maggeo_waypt_pr(const Waypoint* waypointp)
            0 : waypointp->altitude);
   append(obuf, CSTRc(waypointp->shortname));
   append(obuf, CSTR(cname));
-  append(obuf, placer.toUtf8().data());
-  append(obuf, waypointp->gc_data->hint.toUtf8().data());
+  append(obuf, CSTR(placer));
+  append(obuf, CSTR(waypointp->gc_data->hint));
   append(obuf, ctype);
   append(obuf, placeddate.toUtf8());
   append(obuf, lfounddate.toUtf8());
index 1fc5ad5cded2eff1ccb73721c015ea3cce36f09c..6e88d016e4734ec22b19b3c2d667ea252d9332ba 100644 (file)
@@ -1415,7 +1415,7 @@ mag_waypt_pr(const Waypoint* waypointp)
           wpt_len,
           CSTRc(owpt),
           CSTRc(odesc),
-          icon_token.toUtf8().data());
+          CSTR(icon_token));
   mag_writemsg(obuf);
 
   if (!is_file) {
index 3834c2af47754d99b50325cc1d63d49980a29f4e..7816ec186ceee220c10826f87080dadfbfe67a87 100644 (file)
@@ -121,7 +121,7 @@ vcf_disp(const Waypoint* wpt)
     vcf_print(s);
     xfree(s);
   } else {
-    vcf_print(wpt->gc_data->hint.toUtf8().data());
+    vcf_print(CSTR(wpt->gc_data->hint));
   }
 
   gbfprintf(file_out, "\nEND:VCARD\n");
index 55696f8f2d5810314d8de869c0fdd15c3801d669..0e5232efadd56e35fe19b19c0d7abad11764b602 100644 (file)
@@ -62,7 +62,7 @@ xml_tbl_lookup(const QString& tag, xg_cb_type cb_type)
 {
   xg_tag_mapping* tm;
   for (tm = xg_tag_tbl; tm->tag_cb != NULL; tm++) {
-    if (str_match(tag.toUtf8().data(), tm->tag_name) && (cb_type == tm->cb_type)) {
+    if (str_match(CSTR(tag), tm->tag_name) && (cb_type == tm->cb_type)) {
       return tm->tag_cb;
     }
   }
index f7880ac8bc2f7ed360a106c33bb4bfb5ed8e107d..3a6eee20b350da71ad0d1f989fa69ec0e8b86465 100644 (file)
@@ -240,7 +240,7 @@ xol_waypt_disp_cb(const Waypoint* wpt)
   gbfprintf(fout, "%*s<shape type=\"waypoint\"", space++*2, "");
   xol_write_string("name", name);
   xol_write_string("comment", wpt->notes);
-  xol_write_string("icon", wpt->icon_descr.toUtf8().data());
+  xol_write_string("icon", wpt->icon_descr);
   if (wpt->creation_time.isValid()) {
     xol_write_time(wpt);
   }